make windows release script work for any clone name. (#140)
authortsteven4 <tsteven4@users.noreply.github.com>
Tue, 5 Dec 2017 22:03:16 +0000 (15:03 -0700)
committerGitHub <noreply@github.com>
Tue, 5 Dec 2017 22:03:16 +0000 (15:03 -0700)
tools/make_windows_release.ps1

index 553a8b990ea5cbf425a3b9c47a6c711b03a09cf8..2076bba382e9030fb8e43efafd7326e3e1923e4c 100755 (executable)
@@ -3,7 +3,7 @@
 # Run this from a Qt Desktop command window that has the Qt and mingw compiler paths set up,\r
 # such as the one Qt Creator will put on the start menu.\r
 # For example, to run overriding the default locations of windeployqt and ISSC:\r
-# powershell.exe -ExecutionPolicy Unrestricted -File tools\make_windows_release.ps1 -windeployqt "C:\Qt\5.6.3\mingw49_32\bin\windeployqt.exe" -iscc "C:\Program Files (x86)\Inno Setup 5\ISCC.exe"\r
+# powershell.exe -ExecutionPolicy Unrestricted -File tools\make_windows_release.ps1 -windeployqt "C:\Qt\5.5\mingw492_32\bin\windeployqt.exe" -iscc "C:\Program Files (x86)\Inno Setup 5\ISCC.exe"\r
 #\r
 # Be aware this script is used by appveyor.yml\r
 # \r
 Param(\r
   $windeployqt =  "C:\Qt\5.6\mingw49_32\bin\windeployqt.exe",\r
   $iscc = "C:\Program Files (x86)\Inno Setup 5\ISCC.exe",\r
-  $gpsbabel_build_dir = "build-GPSBabel-Desktop_Qt_5_5_1_Mingw_32bit-Release",\r
-  $gui_build_dir = "build-app-Desktop_Qt_5_5_1_MinGW_32bit-Release"\r
+  $gpsbabel_build_dir_name = "build-GPSBabel-Desktop_Qt_5_5_1_Mingw_32bit-Release",\r
+  $gui_build_dir_name = "build-app-Desktop_Qt_5_5_1_MinGW_32bit-Release"\r
 )\r
 # verify we are in the top of the gpsbabel clone\r
 Get-Item tools/make_windows_release.ps1 -ErrorAction Stop\r
+$gpsbabel_src_dir = "$Pwd"\r
+$gpsbabel_build_dir = "$($gpsbabel_src_dir)\..\$($gpsbabel_build_dir_name)"\r
+$gui_build_dir = "$($gpsbabel_src_dir)\$($gui_build_dir_name)"\r
 # mimic creator shadow build to match Inno setup file\r
 # make sure we are staring with a clean build directory\r
-Remove-Item "..\$($gpsbabel_build_dir)" -Recurse -ErrorAction Ignore\r
-New-Item "..\$($gpsbabel_build_dir)" -type directory -force\r
-cd "..\$($gpsbabel_build_dir)"\r
-qmake ..\gpsbabel\GPSBabel.pro -spec win32-g++\r
+Remove-Item "$($gpsbabel_build_dir)" -Recurse -ErrorAction Ignore\r
+New-Item "$($gpsbabel_build_dir)" -type directory -force\r
+Set-Location "$($gpsbabel_build_dir)"\r
+qmake "$($gpsbabel_src_dir)\GPSBabel.pro" -spec win32-g++\r
+if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode)  }\r
 mingw32-make qmake_all\r
 mingw32-make\r
 if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode)  }\r
 # copy GPSBabel.exe for use by test_script\r
-Remove-Item ..\gpsbabel\release -Recurse -ErrorAction Ignore\r
-New-Item ..\gpsbabel\release -type directory -force\r
-Copy-Item release\GPSBabel.exe ..\gpsbabel\release\GPSBabel.exe\r
-cd ..\gpsbabel\r
+Remove-Item "$($gpsbabel_src_dir)\release" -Recurse -ErrorAction Ignore\r
+New-Item "$($gpsbabel_src_dir)\release" -type directory -force\r
+Copy-Item release\GPSBabel.exe "$($gpsbabel_src_dir)\release\GPSBabel.exe"\r
+Set-Location "$($gpsbabel_src_dir)"\r
 # make sure we are staring with a clean build directory\r
 Remove-Item "$($gui_build_dir)" -Recurse -ErrorAction Ignore\r
 New-Item "$($gui_build_dir)" -type directory -force\r
-cd "$($gui_build_dir)"\r
-qmake ..\gui\app.pro -spec win32-g++\r
+Set-Location "$($gui_build_dir)"\r
+qmake "$($gpsbabel_src_dir)\gui\app.pro" -spec win32-g++\r
+if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode)  }\r
 mingw32-make qmake_all\r
 mingw32-make\r
 if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode)  }\r
-lupdate ..\gui\app.pro\r
-lrelease ..\gui\app.pro\r
+lupdate "$($gpsbabel_src_dir)\gui\app.pro"\r
+lrelease "$($gpsbabel_src_dir)\gui\app.pro"\r
 # windeployqt in 5.5.1 suffers from bug\r
 # https://bugreports.qt.io/browser/QTBUG-48946\r
 # which trashes the translations.  Work around\r
@@ -47,5 +52,8 @@ lrelease ..\gui\app.pro
 # bug fixed.\r
 # use --plugindir option to locate the plugins.\r
 & "$($windeployqt)" --verbose 10 --plugindir release\plugins release\GPSBabelFE.exe\r
-& "$($iscc)" ..\gui\setup.iss\r
-cd ..\r
+if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode)  }\r
+Set-Location "$($gpsbabel_src_dir)\gui"\r
+& "$($iscc)" setup.iss\r
+if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode)  }\r
+Set-Location "$($gpsbabel_src_dir)"\r